package org.itboys.fuzion.service;

import java.util.Date;

import javax.annotation.Resource;

import org.itboys.fuzion.entity.IncomeExpenditureRecords;
import org.itboys.mongodb.core.MongoDataSource;
import org.itboys.mongodb.service.BaseService;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;

/**
 * 会员和店铺收支记录明细
 * @author weisky
 *
 * 2016年4月15日
 */
@Service
public class IncomeExpenditureRecordsService extends BaseService<IncomeExpenditureRecords, Long>{

	private static final long serialVersionUID = 1L;

	@Resource(name = "memberDS")
	private MongoDataSource ds;
	
	@Override
	protected MongoDataSource getMongoDataSource() {
		return ds;
	}
	
	/**
	 * 新增一条记录
	 * @param ier
	 * @return
	 */
	public boolean insert(IncomeExpenditureRecords ier){
		try{
			super.save(ier);
			logger.info("新增收支记录明细成功，IncomeExpenditureRecords="+JSON.toJSONString(ier)+",新增时间="+new Date());
			return true;
		}catch(Exception e){
			e.printStackTrace();
			logger.error("IncomeExpenditureRecordsService.insert err", e);
		}
		return false;
	}

}
